<?php

class ZFKiller_View_Helper_FormPaisUfCidade extends Zend_View_Helper_FormSelect {

	public function formPaisUfCidade($name, $value = null, $attribs = null, $options = null, $listsep = "<br />\n") {
		if (!isset($attribs['class'])) {
			$attribs['class'] = '';
		}

		$attribsPais = $attribs;
		$attribsPais['id'] .= 'Pais';
		$attribsPais['class'] .= ' pais';

		$attribsUf = $attribs;
		$attribsUf['id'] .= 'Uf';
		$attribsUf['class'] .= ' uf';

		$attribsUfText = $attribs;
		$attribsUfText['id'] .= 'UfText';
		$attribsUfText['class'] .= ' uftext hidden';
		
		$attribsCidadeText = $attribs;
		$attribsCidadeText['id'] .= 'Text';
		$attribsCidadeText['class'] .= ' cidadetext hidden';

		$attribs['class'] .= ' cidade';

		$nameUf = $name . 'Uf';

		$formSelectPais = $this->formSelect($name . 'Pais', $this->view->optionsPaisValue, $attribsPais, $this->view->optionsPais);
		$formSelectUf = $this->formSelect($name . 'Uf', $this->view->optionsUFValue, $attribsUf, $this->view->optionsUF);
		$formInputUf = $this->view->formText($name . 'UfText', '', $attribsUfText, $options);
		$formSelectCidade = $this->formSelect($name, $value, $attribs, $options);
		$formInputCidade = $this->view->formText($name . 'Text', '', $attribsCidadeText, $options);
		
		return
				'<span class="p"><span>Pais</span>' . $formSelectPais . '</span>'
				. '<span class="u"><span>Uf</span>' . $formSelectUf . $formInputUf . '</span>'
				. '<span class="c"><span>Cidade</span>' . $formSelectCidade . $formInputCidade . '</span>';
	}

}